package L298NDriver;

/**
 * The interface to control the L298N Dual Full H-bridge. This interface overlays
 * with the four states described in the operations manual of the L298N.
 * @author JaredSmith
 */
public interface IL298NDriver {

    /**
     * This method needs to set the pin that is connected to input A high as
     * well as the enable pin. Input B is left low.
     *
     * NOTE: This method uses Pulse Width Modulation to drive the bridge. If PWM
     * is not needed it is recomended to use DirectionA() method.
     *
     * @param duty The dudte cycle to Pulse Width Modulate at.
     */
    void PWMDirectionA(int duty);

    /**
     * This method needs to set the pin that is connected to input B high as
     * well as the enable pin. Input A is left low.
     *
     * NOTE: This method uses Pulse Width Modulation to drive the bridge. If PWM
     * is not needed it is recomended to use DirectionB() method.
     *
     * @param duty The dudte cycle to Pulse Width Modulate at.
     */
    void PWMDirectionB(int duty);

    /**
     * This method is for running direction A without Pulse Width Modulation.
     * Set input A and enable hight as well as input B low.
     *
     * NOTE: This method does not use Pulse Width Modulation to drive the bridge.
     * If PWM is needed it is recomended to use DirectionA(int duty)
     *
     */
    void DirectionA();

    /**
     * This method is for running direction B without Pulse Width Modulation.
     * Set input B and enable hight as well as input A low.
     *
     * NOTE: This method does not use Pulse Width Modulation to drive the bridge.
     * If PWM is needed it is recomended to use DirectionB(int duty)
     */
    void DirectionB();

    /**
     * Set L298N to the stop state by powering the enable pin and setting
     * input A and B to the same.
     */
    void Stop();

    /**
     * Set L298N to the free running state by setting the enable pin to low.
     */
    void FreeRunning();

}
